<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>{% block title %}Welcome{% endblock %}</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        {% if site_meta_description %}
        <meta name="description" content="{{ site_meta_description }}" />
        {% endif %}
        {% if site_meta_keywords %}
        <meta name="keywords" content="{{ site_meta_keywords }}" />
        {% endif %}
        {% block stylesheets %}
        <link href="{{ asset('css/font.css') }}" rel="stylesheet" />
        {% if app.request.locale == 'ar' %}
        <link href="{{ asset('css/bootstrap-ar.css') }}" rel="stylesheet" />
        <link href="{{ asset('css/mianStyle-ar.css') }}" rel="stylesheet" />
        {% else %}
        <link href="{{ asset('css/bootstrap.css') }}" rel="stylesheet" />
        <link href="{{ asset('css/mianStyle.css') }}" rel="stylesheet" />
        {% endif %}
        {% endblock %}

        <!--[if IE]>
            <link href="{{ asset('css/ie8.css') }}" rel="stylesheet" />
        <![endif]-->

        <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
        <!--[if lt IE 9]>
            <script src="{{ asset('js/html5shiv.js') }}"></script>
        <![endif]-->

        <!--[if gte IE 9]>
            <style type="text/css">
                body {
                    filter: none;
                }
            </style>
        <![endif]-->

        <!-- Fav and touch icons -->
        {#<link rel="apple-touch-icon-precomposed" sizes="144x144" href="{{ asset('ico/apple-touch-icon-144-precomposed.png') }}" />
        <link rel="apple-touch-icon-precomposed" sizes="114x114" href="{{ asset('ico/apple-touch-icon-114-precomposed.png') }}" />
        <link rel="apple-touch-icon-precomposed" sizes="72x72" href="{{ asset('ico/apple-touch-icon-72-precomposed.png') }}" />
        <link rel="apple-touch-icon-precomposed" href="{{ asset('ico/apple-touch-icon-57-precomposed.png') }}" />#}
        <link rel="shortcut icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
    </head>

    <body>
        <div id="fb-root"></div>
        <script>(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) return;
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));</script>
            <div class="wrapper">
                <div class="container">

                    <div class="header">
                        <div class="row-fluid">
                            <a class="logo" href="{{ path('site_homepage') }}">
                                <img alt="{% trans %}Educino logo{% endtrans %}" src="{{ asset('img/logo.png') }}" />
                            </a>
                            <div class="right">
                                
                                {% for flashMessage in app.session.flashbag.get('successSignup') %}
                                    <div class="alert-success alert">
                                        <button type="button" class="close" data-dismiss="alert">&times;</button>
                                        {# also edit the next message in the signup action #}
                                        {% trans %}welcome{% endtrans %} {{ app.user }} {% trans %}to our site{% endtrans %}, {% trans %}please check your email for your activation link{% endtrans %}.
                                    </div>
                                {% else %}  
                                    {% if is_granted('ROLE_NOTACTIVE') and not is_granted('ROLE_USER') %}
                                        <div class="alert-info alert">
                                            <button type="button" class="close" data-dismiss="alert">&times;</button>
                                            {% trans %}Your account is not active, please check your email for your activation link{% endtrans %}.
                                        </div>
                                    {% endif %}
                                {% endfor %}
                                {% for flashMessage in app.session.flashbag.get('accountActive') %}
                                    <div class="alert-info alert">
                                        <button type="button" class="close" data-dismiss="alert">&times;</button>
                                        {% trans %}Your account is already active{% endtrans %}.
                                    </div>
                                {% endfor %}
                                {% for flashMessage in app.session.flashbag.get('invalidConfirmationCode') %}
                                    <div class="alert-error alert">
                                        <button type="button" class="close" data-dismiss="alert">&times;</button>
                                        {% trans %}Invalid confirmation code{% endtrans %}.
                                    </div>
                                {% endfor %}
                                {% for flashMessage in app.session.flashbag.get('accountIsNowActive') %}
                                    <div class="alert-success alert">
                                        <button type="button" class="close" data-dismiss="alert">&times;</button>
                                        {% trans %}Your account is now active{% endtrans %}.
                                    </div>
                                {% endfor %}
                                {% for flashMessage in app.session.flashbag.get('emailSent') %}
                                    <div class="alert-success alert">
                                        <button type="button" class="close" data-dismiss="alert">&times;</button>
                                        {% trans %}Done, please check your Email{% endtrans %}.
                                    </div>
                                {% endfor %}
                                {% for flashMessage in app.session.flashbag.get('passwordChanged') %}
                                    <div class="alert-success alert">
                                        <button type="button" class="close" data-dismiss="alert">&times;</button>
                                        {% trans %}Password changed successfully{% endtrans %}.
                                    </div>
                                {% endfor %}

                                {% if not is_granted('ROLE_NOTACTIVE') %}
                                    <div class="loginBlock">
                                        <form class="loginForm" action="{{ path('login_check') }}" method="post">
                                            <div class="input-prepend left">
                                                <span class="add-on userName"></span>
                                                <input class="span10" tabindex="1" name="_username" type="text" placeholder="{% trans %}Username / Email{% endtrans %}" />
                                                <span class="clear">
                                                    <label class="checkbox">
                                                        <input type="checkbox" tabindex="3" name="_remember_me" checked="" />{% trans %}Remember me{% endtrans %}
                                                    </label>
                                                </span>
                                            </div>
                                            <div class="input-prepend left">
                                                <span class="add-on password"></span>
                                                <input class="span10" name="_password" tabindex="2" type="password" placeholder="{% trans %}Password{% endtrans %}"/>
                                                <span class="clear">
                                                    <a href="{{ path('user_forgot_password') }}">{% trans %}Forgot password ?{% endtrans %}</a>
                                                </span>
                                            </div>
                                            <button type="submit" class="btn blue loginBtn left">{% trans %}Log In{% endtrans %}</button>
                                            <button type="button" class="btn signUpBtn left"  href="#signUpAndLogin" role="button" data-toggle="modal">{% trans %}Sign Up{% endtrans %}</button>
                                        </form>
                                    </div>
                                {% else %}
                                    <span class="logedInUser clear right" style="display: inline-block;">
                                    {% trans %}Welcome{% endtrans %} <a {% if is_granted('ROLE_ADMIN') %}href="{{ path('admin_home') }}" target="_blank"{% else %}href="{{ path('user_edit') }}"{% endif %}>{{ app.user }}</a> | <a href="{{ path('logout') }}">{% trans %}Log Out{% endtrans %}</a> <a {% if is_granted('ROLE_ADMIN') %}href="{{ path('user_admin_list', {'filter[_sort_order]': 'DESC', 'filter[_sort_by]': 'newMessagesCount'}) }}" target="_blank"{% else %}href="{{ path('user_messages') }}"{% endif %} class="inbox"><span id="unreadMessagesCount">0</span> {% trans %}messages{% endtrans %}</a>
                                        </span>
                                {% endif %}

                                        <ul class="contactSocial">
                                {% if site_email %}
                                                <li><a href="mailto:{{ site_email }}" class="mailUs"></a></li>
                                {% endif %}
                                {% if site_telephone %}
                                                <li><span class="tel-No">{{ site_telephone }}</span></li>
                                {% endif %}                
                                {% if facebook_profile_link %}
                                                <li><a href="{{ facebook_profile_link }}" rel="nofollow" target="_blank" class="facebook"></a></li>
                                {% endif %}
                                {% if twitter_profile_link %}
                                                <li><a href="{{ twitter_profile_link }}" rel="nofollow" target="_blank" class="twitter"></a></li>
                                {% endif %}
                                {% if linkedin_profile_link %}
                                                <li><a href="{{ linkedin_profile_link }}" rel="nofollow" target="_blank" class="linkedin"></a></li>
                                {% endif %}
                                {% if googleplus_profile_link %}
                                                <li><a href="{{ googleplus_profile_link }}" rel="nofollow" target="_blank" class="google"></a></li>
                                {% endif %}
                                            </ul>
                                        </div>
                                    </div>

                                    <div class="navbar">
                                        <div class="navbar-inner">
                                            <div class="container">
                                                <ul class="nav">
                                                    <li{% block home_attributes %}{% endblock %}><a href="{{ path('site_homepage') }}">{% trans %}Home{% endtrans %}</a></li>
                                                    <li{% block about_attributes %}{% endblock %}><a href="{{ path('about') }}">{% trans %}About Us{% endtrans %}</a>
                                                        <ul class="subMenu">
                                                            <li><a href="{{ path('testimonials') }}">{% trans %}Testimonials{% endtrans %}</a></li>
                                                            <li><a href="{{ path('career') }}">{% trans %}Careers{% endtrans %}</a></li>
                                                        </ul>
                                                    </li>
                                                    <li{% block services_attributes %}{% endblock %}><a href="{{ path('services') }}">{% trans %}Services{% endtrans %}</a></li>
                                                    <li{% block resources_attributes %}{% endblock %}><a href="#">{% trans %}Resources{% endtrans %}</a>
                                                        <ul class="subMenu">
                                                            <li><a href="{{ path('scholarships') }}">{% trans %}Scholarships And Fellowships{% endtrans %}</a></li>
                                                            <li><a href="{{ path('list_blogs') }}">{% trans %}Blog{% endtrans %}</a></li>
                                                            <li><a href="{{ path('list_questions') }}">{% trans %}Ask An Expert{% endtrans %}</a></li>
                                                        </ul>
                                                    </li>
                                                    <li{% block contactus_attributes %}{% endblock %}><a href="{{ path('contact_us') }}">{% trans %}Contact Us{% endtrans %}</a></li>
                                    {% if is_granted('ROLE_ADMIN') %}
                                                    <li><a href="{{ path('admin_home') }}">{% trans %}Admin Area{% endtrans %}</a>
                                                    </li>
                                    {% elseif is_granted('ROLE_NOTACTIVE') %}
                                                    <li{% block account_attributes %}{% endblock %}><a href="#">{% trans %}My Account{% endtrans %}</a>
                                                        <ul class="subMenu">
                                                            <li><a href="{{ path('user_edit') }}">{% trans %}Profile{% endtrans %}</a></li>
                                                            <li><a href="{{ path('user_messages') }}">{% trans %}Messages{% endtrans %}</a></li>
                                                            <li><a href="{{ path('my_services') }}">{% trans %}My Services{% endtrans %}</a></li>
                                                        </ul>
                                                    </li>
                                    {% endif %}
                                                    <li class="language right">
                                        {% if app.request.locale == 'ar' %}
                                        {% set currentLocale = 'en' %}
                                        {% else %}
                                        {% set currentLocale = 'ar' %}
                                        {% endif %}
                                                            <a href="{{ path(app.request.get('_route'), app.request.get('_route_params') | merge({'_locale': currentLocale})) }}" ><i class="icon-language-{% if app.request.locale == 'en' %}ar{% else %}en{% endif %}"></i></a>
                                                        </li>
                                                    </ul>
                                                </div>
                                            </div>
                                        </div><!-- /.navbar -->
                                    </div>

            {% block body %}{% endblock %}
                                </div> <!-- /container -->
                                <div class="footer row-fluid">

                                    <div class="footerNav">
                                        <div class="container">
                                            <ul>
                                                <li><a href="{{ path('site_homepage') }}">{% trans %}Home{% endtrans %}</a></li>
                                                <li><a href="{{ path('about') }}">{% trans %}About Us{% endtrans %}</a></li>
                                                <li><a href="{{ path('services') }}">{% trans %}Services{% endtrans %}</a></li>
                                                <li><a href="#">{% trans %}Resources{% endtrans %}</a></li>
                                                <li><a href="{{ path('contact_us') }}">{% trans %}Contact Us{% endtrans %}</a></li>
                                            </ul>
                                        </div>
                                    </div>
                                    <div class="footerSocial">
                                        <div class="container">
                                            <ul>
                            {% if facebook_profile_link %}
                                                    <li><a href="{{ facebook_profile_link }}" class="facebook"></a></li>
                            {% endif %}
                            {% if twitter_profile_link %}
                                                    <li><a href="{{ twitter_profile_link }}" class="twitter"></a></li>
                            {% endif %}
                            {% if linkedin_profile_link %}
                                                    <li><a href="{{ linkedin_profile_link }}" class="linkedin"></a></li>
                            {% endif %}
                            {% if googleplus_profile_link %}
                                                    <li><a href="{{ googleplus_profile_link }}" class="google"></a></li>
                            {% endif %}
                                                </ul>
                                            </div>
                                        </div>
                                        <div class="copyrights">
                                            <div class="container">
                        {% trans %}Please call{% endtrans %} {{ site_telephone }} {% if site_email %}{% trans %}or{% endtrans %} <a href="mailto:{{ site_email }}" >{% trans %}email us{% endtrans %}</a>{% endif %} {% trans %}to discuss your educational objectives or to learn more about our services{% endtrans %}.
                                                    <br/>
                                                    <p>{% if app.request.locale == 'en' %}Copyright &copy; {{ "now"|date("Y") }} Educino, All rights reserved.{% else %}حق النشر &copy; {{ "now"|date("Y") }} Educino, جميع الحقوق محفوظة.{% endif %} <a class="termsAndPrivacy" href="{{ path('terms')}}">{% trans %}Terms of Use{% endtrans %}</a> <a href="{{ path('privacy') }}">{% trans %}Privacy Policy{% endtrans %}</a></p> 
                                                </div>
                                            </div>
                                        </div>
                                    </div>

        {% if not is_granted('ROLE_NOTACTIVE') %}
                                    <div class="modalContainer">
                                        <div id="signUpAndLogin" class="modal hide fade wetAsphalt" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                                            <div class="modalForm">
                                                <div class="modal-header">
                                                    <h3 id="myModalLabel">{% trans %}Sign Up{% endtrans %}</h3>
                                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                                </div>

                                                <div class="modal-body">
                                                    <ul id="myTab" class="nav nav-tabs tabsVertical">
                                                        <li class="active"><a href="#SignUpTab" data-toggle="tab">{% trans %}Sign Up{% endtrans %}</a></li>
                                                        <li><a href="#loginTab" data-toggle="tab">{% trans %}Log in{% endtrans %}</a></li>
                                                    </ul>

                                                    <div id="myTabContent" class="tab-content">
                                                        <div class="tab-pane fade" id="loginTab">
                                                            <form action="{{ path('login_check') }}" method="post">
                                                                <div class="input-prepend left">
                                                                    <span class="add-on userName"></span>
                                                                    <input class="input-large" name="_username" type="text" placeholder="{% trans %}Username{% endtrans %}" />
                                                                </div>

                                                                <div class="input-prepend ">
                                                                    <span class="add-on password"></span>
                                                                    <input class="input-large" name="_password" type="password" placeholder="{% trans %}Password{% endtrans %}" />
                                                                </div>

                                                                <label class="checkbox clear left">
                                                                    <input type="checkbox" name="_remember_me" checked="" />{% trans %}Remember me{% endtrans %}
                                                                </label>
                                                                <a href="{{ path('user_forgot_password') }}" class="left forgetMyPassword"> {% trans %}Forgot password ?{% endtrans %}</a>

                                                                <div class="control-group">
                                                                    <div class="controls">
                                                                        <button type="submit" class="btn blue right">{% trans %}Login{% endtrans %}</button>
                                                                    </div>
                                                                </div>
                                                            </form>
                                                        </div>

                                                        <div class="tab-pane fade in active" id="SignUpTab">
                                {% render url('user_signup_form') %}
                                                            </div>
                                                        </div>
                                                    </div>

                                                    <div class="modal-footer">
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
        {% endif %}

        {% block javascripts %}
                                        <!--  javascript
                                        ================================================== -->
                                        <!-- Placed at the end of the document so the pages load faster -->
                                        <script src="{{ asset('js/jquery.js') }}"></script>
                                        <script src="{{ asset('js/bootstrap.js') }}"></script>
                                        <script>
                                            {% if analytics_app_id %}
                                            var _gaq = [['_setAccount', '{{ analytics_app_id }}'], ['_trackPageview']];
                                            (function(d, t) {
                                                var g = d.createElement(t), s = d.getElementsByTagName(t)[0];
                                                g.src = ('https:' == location.protocol ? '//ssl' : '//www') + '.google-analytics.com/ga.js';
                                                s.parentNode.insertBefore(g, s)
                                            }(document, 'script'));
                                            {% endif %}
                                            {% if is_granted('ROLE_ADMIN') %}
                                            function checkOnUnreadMessages() {
                                                $.ajax({
                                                    url: '{{ path('admin_unread_messages_count') }}',
                                                    success : function(data) {
                                                        $('#unreadMessagesCount').html(data);
                                                    }
                                                });
                                            }
                                            $(document).ready(function() {
                                                checkOnUnreadMessages();
                                                setInterval(checkOnUnreadMessages, 5000);
                                            });
                                            {% elseif is_granted('ROLE_USER') %}
                                            function checkOnUnreadMessages() {
                                                $.ajax({
                                                    url: '{{ path('user_unread_messages_count') }}',
                                                    success : function(data) {
                                                        $('#unreadMessagesCount').html(data);
                                                    }
                                                });
                                            }
                                            $(document).ready(function() {
                                                checkOnUnreadMessages();
                                                setInterval(checkOnUnreadMessages, 5000);
                                            });
                                            {% endif %}
                                            $(document).ready(function() {
                                                //collapse
                                                $(".collapse").collapse();
                                            });
                                            </script>
        {% endblock %}
                                        </body>
                                    </html>